package com.itheima.home_work.bank_credit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DecisionSupportSystem {
    private static final Logger logger = LoggerFactory.getLogger("DecisionSupportSystem");

    // 根据客户的信用评分和风险等级做出贷款审批决策
    public void makeLoanApprovalDecision(Customer customer) {

        // 根据客户的信用评分和风险等级做出贷款审批决策
        // 实现具体的决策逻辑 如果级别是LOW,不予批准
        // 如果是其它： MEIDIUM 客户的收入 * 信用评分/100*50%  HIGH客户的收入 * 信用评分/100*100%
        final CreditScoringModel model = new CreditScoringModel();
        final int creditScore = model.calculateCreditScore(customer);
        final RiskClassifier riskClassifier = new RiskClassifier();
        final RiskLevel riskLevel = riskClassifier.classifyRisk(creditScore);

        switch (riskLevel) {
            case LOW -> logger.info("卡片 " + customer.getId() + " 风险等级是LOW, 不予批准");
            case MEDIUM -> logger.info("卡片 " + customer.getId() + " 风险等级MEDIUM，建议额度 " + customer.getIncome() * creditScore / 100 * 0.5);
            case HIGH -> logger.info("卡片 " + customer.getId() + " 风险等级HIGH，建议额度 " + customer.getIncome() * creditScore / 100);
        }
    }
}
